home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / minix / up1510b.tgz / up1510b / src / commands / recover.c < prev    next >
C/C++ Source or Header  |  1990-07-19  |  1KB  |  42 lines

  1. /* recover - un-remove a file        Author: Andy Tanenbaum */
  2.  
  3. /* Unlike most UNIX systems, MINIX provides a way to recover a file that
  4.  * has been accidently rm'ed.  The recovery is done using Terrence Holm's
  5.  * 'de' (disk editor) program, plus some patches to FS that keep the i-node
  6.  * number in the directory, even after the file has been removed.  A file
  7.  * cannot be recovered after its directory slot has been reused.
  8.  *
  9.  * Usage:
  10.  *    recovery file ...
  11.  *
  12.  * Note: the file names must be fully explicit; wild cards are not allowed.
  13.  * It is not possible, for example, to say recover *.c.  All the files must
  14.  * be named in full.  Since the last two bytes of the directory entry are
  15.  * used for the i-node number, only the first 12 characters of the file name
  16.  * count.  Full 14 character file names can be specified, however, only the
  17.  * last two characters, in fact, play no role in locating the file.
  18.  */
  19.  
  20. main(argc, argv)
  21. int argc;
  22. char *argv[];
  23. {
  24.   int i;
  25.   char buf[1024];
  26.  
  27.   if (argc == 1) usage();
  28.  
  29.   for (i = 1; i < argc; i++) {
  30.     strcpy(buf, "de -r ");
  31.     strcat(buf, argv[i]);
  32.     system(buf);
  33.   }
  34. }
  35.  
  36.  
  37. usage()
  38. {
  39.   std_err("Usage: recover file ...\n");
  40.   exit(1);
  41. }
  42.